home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Aventura
/
FireMan.swf
/
scripts
/
frame_1179
/
PlaceObject2_1084_67
/
CLIPACTIONRECORD onClipEvent(enterFrame).as
next >
Wrap
Text File
|
2008-09-12
|
4KB
|
201 lines
onClipEvent(enterFrame){
function wallizq()
{
return dx < 0 && mapa.hitTest(_X - 10,_Y - 10,true);
}
function wallder()
{
return dx > 0 && mapa.hitTest(_X + 10,_Y - 10,true);
}
function suelo()
{
return _Y >= 194;
}
function setScale()
{
if(death)
{
return undefined;
}
if(idle || stand || attack1)
{
if(_X > heroe._x)
{
_xscale = -1 * Math.abs(_xscale);
}
else
{
_xscale = Math.abs(_xscale);
}
}
if(run)
{
_xscale = dx <= 0 ? -1 * Math.abs(_xscale) : Math.abs(_xscale);
}
}
function drawFrame()
{
if(death)
{
this.gotoAndStop("ouch");
return undefined;
}
if(attack1)
{
this.gotoAndStop("attack1");
}
if(run)
{
this.gotoAndStop("run");
}
if(jump)
{
this.gotoAndStop("jump");
}
if(fall)
{
if(attackjID)
{
this.gotoAndStop("attackj" + attackjID);
}
else
{
this.gotoAndStop("fall");
}
}
if(stand)
{
this.gotoAndStop("stand2");
}
}
_X = _X - heroe.scrollspeed;
hitable = this.hitTest(_root.mascara);
if(!death)
{
if(this.sprite.hotzone.hitTest(heroe.sprite.hotzone))
{
heroe.hitted = true;
}
if(this.sprite.hotzone.hitTest(_root.shoot1) && hitable)
{
hitted = true;
_root.shoot1.impact = true;
if(timerdamage != 0)
{
_root.hitted.start();
}
}
if(timerdamage == 0 && hitted)
{
timerdamage = FLASHTIME;
currentdamage += DAMAGE;
_root.bevil.gotoAndStop(currentdamage + 1);
_parent.hittedBIG.start();
}
if(timerdamage > 0)
{
flashing = true;
timerdamage % 3 != 0 ? myColor.setTransform(myColorNormal) : myColor.setTransform(myColorTransform);
timerdamage--;
}
if(flashing && timerdamage == 0)
{
flashing = false;
myColor.setTransform(myColorNormal);
hitted = false;
}
if(currentdamage + 1 >= MAXDAMAGE)
{
myColor.setTransform(myColorTransform);
_root.bevil.gotoAndStop(MAXDAMAGE);
death = true;
}
if(death)
{
_root.shoot1.impact = false;
heroe.keys = false;
_root.bigexp.play();
}
if(idle)
{
idle = false;
run = true;
dx = _xscale <= 0 ? -1 * SPEED : SPEED;
c = 0;
MAXRUN = _root.aleatorio(1,3);
heroe.damage = 1;
}
if(run)
{
heroe.damage = 2;
if(wallizq() || wallder())
{
dx *= -1;
c++;
}
_X = _X + dx;
if(c >= MAXRUN)
{
run = false;
stand = true;
c = 0;
dy = -1 * Math.abs(VSPEED);
}
}
if(stand)
{
heroe.damage = 3;
c++;
if(c > 10)
{
stand = false;
attack1 = true;
}
}
if(attack1)
{
heroe.damage = 5;
if(done)
{
done = attack1 = false;
jump = true;
dy = -1 * Math.abs(VSPEED);
}
}
if(jump)
{
heroe.damage = 2;
if(currenthigh > MAXHIGH)
{
dy *= gravity;
}
_Y = _Y + dy;
currenthigh += Math.abs(dy);
if(dy > -0.5)
{
jump = false;
fall = true;
dy = 0.5;
attackjID = _root.aleatorio(1,2);
}
}
if(fall)
{
heroe.damage = 2;
dy *= accel;
_Y = _Y + dy;
if(suelo())
{
dy = 0;
_Y = 194;
fall = false;
idle = true;
currenthigh = 0;
land.start();
}
}
}
drawFrame();
setScale();
}